<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>HIS hospital info</title>

    <link rel="stylesheet" type="text/css" href="../lib/jquery-easyui-1.4.2/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../lib/jquery-easyui-1.4.2/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../lib/jquery-easyui-1.4.2/demo/demo.css">
    <script type="text/javascript" src="../lib/jquery-easyui-1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="../lib/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../lib/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>

    <script type="text/javascript" src="../lib/moment/moment.min.js"></script>
</head>
<body>
    <div id="id_dailyList">
        <div class="datagrid-toolbar">
            <a href="#" id="btn-ps" class="easyui-linkbutton" iconCls="icon-print" onclick="">打印</a>
            <a href="#" id="btn-undo" class="easyui-linkbutton" iconCls="icon-undo">返回</a>
        </div>
        <div id="id_layout">
            <div data-options="region:'center'" style="height:50px;">
                <div id="id_dailylist_dg"></div>
            </div>
            <div data-options="region:'east',split:false" style="height:50px;width:300px;">
                <div id="id_calendar"></div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">

    var body_w = $("body").width();
    var client_h = document.documentElement.clientHeight;

    var arr = ["20151020","20151021","20151022","20151023"];
    function validtate_calendar_func(){
        //
        var flag = false;
        var date = arguments[0];
        var daily = moment(date);
        console.log("----------");
        console.log("daily.day:", daily.format("YYYYMMDD"));
        for(var i=0;i<arr.length;i++){
            if(arr[i] == daily.format("YYYYMMDD")){
                flag = true;
                break;
            }
        }
        return flag;
    }

    $(function(){
        $("#id_dailyList").panel({
            width: "100%",
            height: client_h,
            title:'日清维护界面',
            border: false,
            closable:true,
            onClose: function(){
                history.back()
                //window.history.back();
            }
        });
        $("#id_layout").css({'width':body_w+'px','height':(client_h-100)+'px'});
        $("#id_layout").layout();


        //日历组件
        $("#id_calendar").calendar({
            current:new Date(),
            width:'100%',
            height:260,
            validator:validtate_calendar_func,
            onSelect:function(date){
                var daily = moment(date);
                console.log("onSelect > daily:", daily);
            },
            onChange:function(newDate, oldDate){
                console.log("newDate:",newDate);
                console.log("oldDate:",oldDate);
            }
        });

        //datagrid组件.
        $('#id_dailylist_dg').datagrid({
            //url:'datagrid_data.json',
            columns:[[
                {field:'code',title:'Code',width:100},
                {field:'name',title:'Name',width:100},
                {field:'price',title:'Price',width:100,align:'right'}
            ]]
        });

    });
</script>
</html>